<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/11
 * Time: 9:19
 */
class demo
{
    public function d()
    {
        echo __FUNCTION__;
    }

    public static function a()
    {
        self::d();
    }
}

//demo::a();
$demo = new demo(); //
//$demo->d();  //这里静态方法执行了  但是会报错 不符合严格的标准

//声明一个员工类 经理继承员工类

//class employee
//{
//    protected $sal = 3000;
//
//    public function getSal()
//    {
//        $this->sal = $this->sal + 1200;
//        return $this->sal;
//    }
//
//}
//class manager extends employee{
//    public function getSal(){
//        parent::getSal();
//        $this->sal=$this->sal+1500;
//        return $this->sal;
//    }
//}
//$emp=new employee();
//echo $emp->getSal();
//echo '<br/>';
//$manager=new manager();
//echo $manager->getSal();
class employee
{
//    protected $sal = 3000;
    private $sal = 3000;

    public function __construct()
    {
//        echo 'asdsadsad4554545';
    }

    public function getSal()
    {
//        $this->sal = $this->sal;
        return $this->sal;
    }

}

class manager extends employee
{
    protected $sal = 5000;

//    public function __construct()
//    {
//        parent::__construct();
//    }

    public function getParentSal()
    {
          return parent::getSal();
    }
}
//
//$emp = new employee();
//echo $emp->getSal();
//echo '<br/>';
$manager = new manager();
echo $manager->getSal();  //3000
echo $manager->getParentSal();//3000

//当父类的属性的权限由private 变为 protected的时候结果变为5000 / 5000
$manager = new manager();
echo $manager->getSal();  //5000
echo $manager->getParentSal();//5000